package test;
import main.Liczba;

import junit.framework.TestCase;

public class LiczbaTestJU3 extends TestCase {
	Liczba l1 = null;
	
	public void setUp() throws Exception{
		l1 =  new Liczba(25);
	}
	
	public void testTwo() throws Exception {
		String str = l1.zamienNa(2);
		assertEquals(str, "11001");
	}
	
	public void testTen() throws Exception {
		String str = l1.zamienNa(10);
		assertEquals(str,"25");
	}
	
	public void testNonZero() throws Exception {
		assertTrue(Integer.parseInt(l1.zamienNa(5), 5)>0 );
	}
	
	public void testZlapodstawa() throws Exception {
		try{
			l1.zamienNa(1);
			fail();
		}catch(Exception e){
			
		}
	}
	
	public void testUjemnaLiczba() throws Exception {
		try{
			Liczba l2 = new Liczba(-1);
			fail();
		}catch(Exception e){
			
		}
	}
	public void testZeroAgnieszki() throws Exception{
		try{
			l1.set(0);
			assertEquals(l1.zamienNa(2),"0");
			assertEquals(l1.zamienNa(4),"0");
			assertEquals(l1.zamienNa(7),"0");
			assertEquals(l1.zamienNa(8),"0");
			assertEquals(l1.zamienNa(10),"0");
			assertEquals(l1.zamienNa(13),"0");
			assertEquals(l1.zamienNa(15),"0");
			assertEquals(l1.zamienNa(16),"0");
		}
		catch(Exception e){}
	}
	public void tearDown() {
		l1 = null;
	}
}
